Gopher Proxy
forthworks.com:70 forthworks.com:70/0/blog/posts/20160321
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Parable: Simple Counted Loops w/Index
Parable's standard set of loop operations provides **times** for performing simple counted loops. But this doesn't provide an index. which is sometimes useful. We can simulate this though using a list and **for-each**.
"Construct a list of values from 1 to 10"
[ 1 10 range ] capture-result
"Do something. The index (the stored value in the list)"
"will be passed in on each cycle"
[ #nan cons 'This is cycle {v}' interpolate<cycling> ]
for-each
I may try to wrap this in a slightly more elegant way later, but it's good enough for now.
you're on forthworks.com^70/0/blog/posts/20160321
back link is forthworks.com:70/1/phlog